function b1i = b1iSignalGen(tNum,PRN,fs,fifT,dIF,phi,dB)
%***北斗B1I中频信号生成器***%
%-----------输出-----------%
% b1i  数字中频信号
%-----------输入-----------%
% PRN = 14;   % PRN号
% fs = 100e6; % 采样率 Hz
% fifT = 25e6;% 理论中频 Hz
% tNum = 1;   % 信号时长 秒
% dIF = 2625; % 载波频偏 Hz
% phi = 0.2;  % 相位偏移
%**************************%
fcT = 2.046e6;       % 测距码理论速率
fif = fifT + dIF;    % 实际中频
fc = fcT + dIF/763;  % 实际码率(1561.098/2.046)
fnh = fc/2046;        % NH码率
fnav = fnh/20;        % 导航电文码率
%% B1C
code = b1iCodeGen(PRN);
NH = [-1,-1,-1,-1,-1, 1,-1,-1, 1, 1,...
      -1, 1,-1, 1,-1,-1, 1, 1, 1,-1]';
navD = 2*randi(2,[1e4,1])-3;    % 导航电文 (仅Data分量有导航电文)
t   = (1/fs:1/fs:tNum).';
amp = 10^((dB+3)/20);
b1i = amp*navD(ceil(t*fnav)).*NH(mod(floor(t*fnh),20)+1).*...
    code(mod(floor(t*fc),2046)+1).*cos(2*pi*fif*t+phi);